﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-tw">
<head>
	<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<script type="text/javascript" src="rc20_pack.js"></script>
	<link rel="stylesheet" type="text/css" href="dcstyle.css"></link>
	<title>刪除 Blogger 留言一點靈</title>
	<meta content="LVCHEN" name="author">
	<meta content="Delete a Comment on Your Blogger Blog 1.0" name="description">
	<!-- Start of StatCounter Code -->
	<script type="text/javascript">
	sc_project=2853597; 
	sc_invisible=1; 
	sc_partition=29; 
	sc_security="206ff9a3"; 
	</script>

	<script type="text/javascript"
	src="http://www.statcounter.com/counter/counter.js"></script><noscript><div
	class="statcounter"><a title="website statistics"
	href="http://www.statcounter.com/" target="_blank"><img
	class="statcounter"
	src="http://c30.statcounter.com/2853597/0/206ff9a3/1/"
	alt="website statistics" ></a></div></noscript>
	<!-- End of StatCounter Code -->
	<script type="text/javascript">
	var lang = window.location.href;
	lang = lang.match(/\lang=en/);
	if (lang == null)
	{
		rcPreSetting.g_iShowCount = 10;
		rcPreSetting.showRCnoPost = true;
		rcPreSetting.authorLink = false;
		rcPreSetting.noContent = ['<font class="noTitle" color="red">文章已被刪除</font>','<p>沒有留言可以顯示</p>'];
		rcPreSetting.reply = [''];
		rcPreSetting.rcAuthorLinkFormat = '%author%';
		rcPreSetting.rcTitleLinkFormat = '%g_szTitle%';
		rcPreSetting.rcFoldImage = ['rc_0609_f.gif','留了言',
'rc_0609_uf.gif','留言說',
'<img src="2-0.gif"/>&nbsp;載入中...',
'全部展開','全部隱藏'];
		rcPreSetting.createDisplayFormat = '%rcAuthorLinkFormat% 於 %rcTitleLinkFormat% %rcSay% 「%content%」 &nbsp;- %timestamp% <img class="deleteLink"  src="http://www.blogger.com/img/icon_delete13.gif" title="刪除留言" onclick="deleteComment(this.parentNode);" onmouseover="this.style.cursor=\'pointer\'" />';
		findOrphan = '找出已刪除文章的留言';
		searchAgain = '重新搜尋？';
		searchFromBegin = '已經是最後一頁，回到第一頁？';
	}
	else
	{
		rcPreSetting.g_iShowCount = 10;
		rcPreSetting.showRCnoPost = true;
		rcPreSetting.authorLink = false;
		rcPreSetting.noContent = ['<font class="noTitle" color="red"><b>Post not found</b></font>','<p>No comment!</p>'];
		rcPreSetting.reply = [''];
		rcPreSetting.today = 'Today';
		rcPreSetting.rcAuthorLinkFormat = '%author%';
		rcPreSetting.rcTitleLinkFormat = '%g_szTitle%';
		rcPreSetting.createDisplayFormat = 'On %rcTitleLinkFormat%, %rcAuthorLinkFormat% %rcSay% &#12300;%content%&#12301; - %timestamp% <img class="deleteLink"  src="http://www.blogger.com/img/icon_delete13.gif" title="Delete This Message" onclick="deleteComment(this.parentNode);" onmouseover="this.style.cursor=\'pointer\'" />';
		rcPreSetting.otherText = ['Go to #','Go','Prev','Next','Message # %range%. There are %totalNum% messages.'],
		rcPreSetting.rcFoldImage = ['rc_0609_f.gif','left a message',
'rc_0609_uf.gif','wrote:',
'<img src="2-0.gif"/>&nbsp;Loading...',
'Show All','Hide All'];
		findOrphan = 'Find the next orphan comment';
		searchAgain = 'Search Again';
		searchFromBegin = 'Go to first page?';
	}

	function loadComments()	{
		var blogName  = jQuery('input:[name="blogDomain"]').val();
		if (blogName != '')	{
			if (blogName.search(/http:\/\//)!=-1)
				blogName = blogName.replace(/http:\/\/(.*)/i,'$1');
			blogName = blogName.replace(/\//gi,'');
			rcPreSetting.g_szBlogDomain= blogName;
			rcSetting.commentStartIndex = 1;
			jQuery('#previewEasy .widget-content').html('<div id="divrc"></div>');
			rcSetting.maxPostsNum = 0;
			rcSetting.commentStartIndex = 1;
			rcSetting.commentTotalNum = 0;
			//rcPreSetting.g_iShowCount = 10;
			rcSetting.showAllFlag = false;
			rcSetting.linkArr = [];
			jQuery('#divrc').html(rcPreSetting.rcFoldImage[4]);
			rcFunction.addHeaderButton();
			rcFunction.fetchComments(rcSetting.commentStartIndex, rcPreSetting.g_iShowCount);
			jQuery('#main').hide();
			jQuery('#main2').show();
		}		
	}
	function deleteComment(object) {
		var allList = document.getElementById('feedItemListDisplay').getElementsByTagName('li');
		var total = document.getElementById('showfooterButton').innerHTML.replace(/<(?:.|\s)*?>/g,'').match(/\d+/g);
		var start = parseInt(total[0]);
		//var end   = total[1];
		for (var i = 0; i < allList.length ; i++)
		{
			if (allList[i] == object)
			break;
		}
		var index = start + i;
		if (jQuery('#gogoDelete').length > 0)
			jQuery('#gogoDelete').remove();
		var y_script = document.createElement('script');
		callbacksrc = 'http://' + rcPreSetting.g_szBlogDomain +	'/feeds/comments/default?max-results=1&start-index=' + index + '&alt=json-in-script&callback=deleting';
		y_script.src = callbacksrc;
		y_script.id = 'jsonPosts';
		y_script.type ='text/javascript';
		document.documentElement.firstChild.appendChild(y_script);
	}
	function deleting(rcJSON){
		var commentLink = rcJSON.feed.entry[0].link;
		for (var i = 0; i < commentLink.length ; i++)
		{
			if (commentLink[i].rel == 'edit')
			break;
		}
		var link = commentLink[i].href.match(/\d+/g);
		var blogID = link[0];
		var postID = link[2];
		link = 'https://www.blogger.com/delete-comment.g?blogID=' + blogID + '&postID=' + postID;
		var newFrame = '<iframe src="'+ link +'" scrolling="no" height="400px" width="100%"></iframe>';	
		jQuery('#main3').find('iframe').remove();
		jQuery('#main3').find('table').after(newFrame).end().show();
		//window.location.replace(link);
	}
	
	function getDeleted(json){
		for (var i = 0; i < json.feed.entry.length ; i++)	{
			if (json.feed.entry[i]["thr$in-reply-to"]==undefined)
				break
		}
		if (i == json.feed.entry.length && json.feed.entry[json.feed.entry.length-1]["thr$in-reply-to"]!=undefined)
		{
			if (rcSetting.commentStartIndex+110 >= rcSetting.commentTotalNum)	{
				jQuery('.widget-content').show().next().remove();
				jQuery('#nextDeleted').text(searchAgain).attr('disabled','');
				rcSetting.commentStartIndex = 1;
			}
			else	{
				rcSetting.commentStartIndex += 100;
				//setTimeout ('Cont_rest();',1000);
				nextDeleted(false);	
			}
		}
		else {
			rcFunction.changePage(0, rcSetting.commentStartIndex+10+i);
			jQuery('.widget-content').show().next().remove();
			if (rcSetting.commentStartIndex+rcPreSetting.g_iShowCount >= rcSetting.commentTotalNum)	{
				jQuery('#nextDeleted').text(searchFromBegin).attr('disabled','');
			}
			else	{
				rcSetting.commentStartIndex += rcPreSetting.g_iShowCount;
				jQuery('#nextDeleted').attr('disabled','');
			}
		}
	}
	
	function nextDeleted(firstLoad){
		if (rcSetting.commentStartIndex+10 <= rcSetting.commentTotalNum){
		if (firstLoad)	{
			jQuery('.widget-content').hide().after('<span id="pleaseWait"><img src="2-0.gif"/>&nbsp;Searching all comments. It may take a few minutes...</span>');
		}
			if (jQuery('#nextDeleted').text() != findOrphan)
				jQuery('#nextDeleted').text(findOrphan);
			jQuery('#jsonCommnets').remove();
			var y_script = document.createElement('script');
			var callbacksrc = 'http://' + rcPreSetting.g_szBlogDomain + '/feeds/comments/default?alt=json-in-script&callback=getDeleted&max-results=100&start-index='+ (rcSetting.commentStartIndex + rcPreSetting.g_iShowCount);
			y_script.src = callbacksrc;
			y_script.id = 'jsonCommnets';
			y_script.type = 'text/javascript';
			document.documentElement.firstChild.appendChild(y_script);
		}
		else	{
			rcFunction.changePage(0, 1);
			jQuery('#nextDeleted').text(findOrphan);
			jQuery('#nextDeleted').attr('disabled','');
		}
	}
	// Because some comment feed has incorrect original post information, loading comment withough post title
	function loadWithoutTitle()	{
		var lang = window.location.href;
		lang = lang.match(/\lang=en/);
		if (lang == null)
			rcPreSetting.createDisplayFormat = '%rcAuthorLinkFormat% %rcSay% 「%content%」 &nbsp;- %timestamp% <img class="deleteLink"  src="http://www.blogger.com/img/icon_delete13.gif" title="刪除留言" onclick="deleteComment(this.parentNode);" onmouseover="this.style.cursor=\'pointer\'" />';
		else
			rcPreSetting.createDisplayFormat = '%rcAuthorLinkFormat% %rcSay% &#12300;%content%&#12301; - %timestamp% <img class="deleteLink"  src="http://www.blogger.com/img/icon_delete13.gif" title="Delete This Message" onclick="deleteComment(this.parentNode);" onmouseover="this.style.cursor=\'pointer\'" />';				
		jQuery('#jsonPosts').remove();
		jQuery('#divrc').next().remove().end().after('<div id="loading">'+rcPreSetting.rcFoldImage[4]+'</div>');
		//rcSetting.commentTotalNum = 0;
		rcFunction.fetchComments(1, 10);
	
	}
	function closeFrame() 	{
		jQuery('#main3').hide();
		jQuery('#jsonCommnets').remove();
		jQuery('#jsonPosts').remove();
		jQuery('#divrc').next().remove().end().after('<div id="loading">'+rcPreSetting.rcFoldImage[4]+'</div>');
		rcSetting.commentTotalNum = 0;
		rcFunction.fetchComments(rcSetting.commentStartIndex, 10);
	}
		jQuery(document).ready(function () {
			if (lang != null) {
				jQuery('.cht').hide();
				jQuery('.eng').show();
				document.title = 'Delete A Blogger Comment';
			}
		});
	
	</script>
</head>
<body>

<div id="outer">
<div style="text-align:center"><div align="center" class="title">
<h1><span class="cht">刪除 Blogger 留言 1.0</span><span class="eng" style="display:none">Delete A Blogger Comment 1.0</span>
</h1>
<p style="color:blue">
	<span class="cht"><a href="http://lvchen.blogspot.com" target="_blank">LVCHEN</a> 熱情製作 - 4/25/2009</span>
	<span class="eng" style="display:none">Programmed by <a href="http://lvchen.blogspot.com" target="_blank">LVCHEN</a> - 3/18/2009</span>
</p>
</div></div>
<div id ="outer2">
	<div id="main">
		<table id="table1" name="table1">
			<tr>
				<td class="tableleft"><span class="cht">部落格網址：</span><span class="eng" style="display:none">Blog URL:&nbsp;</span></td>
				<td class="tableright"><input style="width:180px;" name="blogDomain" onkeypress="if(event.keyCode==13||event.which == 13) {loadComments(); return false;}" type="text" value="" /></td>
				<td>
					<input class="cht" name="retriveData" type="button" value="取得留言" onclick="loadComments();" />
					<input class="eng" name="retriveData" type="button" value="Get Comments" onclick="loadComments();" style="display:none" />
				</td>
			</tr>		
		</table>			
	</div>
	<div id="main2">
		<div id="previewEasy">
			<div class="widget-content">
			</div>
			<div><button id="nextDeleted" onclick="this.disabled = true; nextDeleted(true);return false;"><span class="cht">找出已刪除文章的留言</span><span class="eng" style="display:none">Find the next orphan comment</span></button></br> <button id="loadNoTitle" onclick="this.disabled = true; loadWithoutTitle();return false;"><span class="cht">以無標題方式重新載入留言</span><span class="eng" style="display:none">Load comments again without title</span></button></div>
		</div>
	</div>
	<div id="main3">
		<table style="border:double 3px black;float:right">
			<tr><td><a onclick="closeFrame();" href="javascript:void(0)"><span class="cht">關閉視窗</span><span class="eng" style="display:none">Close</span></a></td></tr>
		</table>
	</div>
</div>	
</div>

<!-- 	<script type="text/javascript">
		
	</script> -->
</body>
</html>